//书写用户登录相关接口
//导入aixos
import request from '@/utils/request'
//导入类型
import type {loginParams,loginResponseData, userInfoResponseData} from './type'

//枚举相关模块接口地址
enum API {
  //登录地址
  LOGIN_URL = '/admin/acl/index/login',
  //用户信息地址
  USERINFO_URL = '/admin/acl/index/info',
  //退出地址
  LOGIN_OUT_URL = '/admin/acl/index/logout',
}

//登录接口:post,请求体需要携带参数{username:'',password:''}
export const reqUserLogin = (data:loginParams) => {
  return request.post<any,loginResponseData>(API.LOGIN_URL,data)
}

//获取用户信息：/admin/acl/index/info get(要携带token)
export const reqUserInfo = () => request.get<any,userInfoResponseData>(API.USERINFO_URL)

//退出
export const reqLoginOut = () => request.post<any,any>(API.LOGIN_OUT_URL)
